!pr1
Paint Yourself into the Corner....................Adam Levin

I think I have come up with an interesting puzzle.  Pretend that your Apple has only 48K of RAM:  no ROM, no soft switches, no memory cards, just 48152 bytes of contiguous RAM from $0000 through $BFFF.  Now, write a program which will store one number (of your choosing) into each and every one of these 49152 locations.  The stumper here is creating a program which can overwrite itself completely, and which will not go running off through the I/O area causing disks to spin, etc.

There are certain limitations to actually implementing this on an Apple.  When you hit <RESET> to examine the contents of memory after running your program, memory will be changed before you can look at it.  It is unavoidable that page zero, the stack, and text screen memory will all get disrupted as soon as <RESET> is pressed.  You still need to include these areas in your program, but you just will not be able to check them.

You will have to figure out some way of stopping the program before it runs off into the $Cxxx space.  I decided to accept this limitation by allowing three bytes at $BFFD-F to contain a JMP instruction, not stuffing my favorite number in them.  So my solution actually only stuffs my number into $0000-$BFFC.

Bob Sander-Cederlof has a solution that stuffs the same number in every byte from $0000 through $BFFF, but depends on two locations in the I/O area to stop the program from rampaging around $Cxxx space.

Try your hand at this puzzle!  Next month we'll show some of the best solutions.
